package com.zhongfl.crm.lixiao.common;

import com.heptagram.lixiao.bean.enums.ContractStatus;
import com.heptagram.lixiao.bean.enums.OpportunityStage;
import com.zhongfl.crm.enums.boss.OrderStatus;

/**
 * @author wang.yuchuan
 * @date 2018/8/27
 */
public class LxStatusConvertUtils {

    /**
     * 把BOSS交付订单状态转换成励销状态码
     *
     * @param orderStatus BOSS交付订单状态
     * @return 励销状态ID
     */
    public static ContractStatus convertDeliverOrderStatus2LxContractStage(OrderStatus orderStatus) {
        switch (orderStatus) {
            case STATUS_CREATED:
                return ContractStatus.STATUS_CREATED;
            case STATUS_COLLECT:
                return ContractStatus.STATUS_COLLECT;
            case STATUS_DECLARE:
                return ContractStatus.STATUS_DECLARE;
            case STATUS_APPROVAL:
                return ContractStatus.STATUS_APPROVAL;
            case STATUS_PIDAI:
                return ContractStatus.STATUS_PIDAI;
            case STATUS_STORAGE:
                return ContractStatus.STATUS_STORAGE;
            case STATUS_APPLICAT:
                return ContractStatus.STATUS_APPLICAT;
            case STATUS_ACCOUNT:
                return ContractStatus.STATUS_ACCOUNT;
            case STATUS_COMPLETED:
                return ContractStatus.STATUS_COMPLETED;
            case STATUS_CANCEL:
                return ContractStatus.STATUS_CANCELED;
            default:
                return null;
        }
    }

    /**
     * 把BOSS客户订单状态转换成励销状态
     *
     * @param orderStatus 客户订单状态
     * @return 励销状态枚举
     */
    public static OpportunityStage convertCustomerOrderStatus2LxOpportunityStage(String orderStatus) {
        switch (orderStatus) {
            case "STATUS_CREATED":
                return OpportunityStage.STATUS_CREATED;
            case "STATUS_COLLECT":
                return OpportunityStage.STATUS_COLLECT;
            case "STATUS_DECLARE":
                return OpportunityStage.STATUS_DECLARE;
            case "STATUS_APPROVAL":
                return OpportunityStage.STATUS_APPROVAL;
            case "STATUS_PIDAI":
                return OpportunityStage.STATUS_PIDAI;
            case "STATUS_STORAGE":
                return OpportunityStage.STATUS_STORAGE;
            case "STATUS_APPLICAT":
                return OpportunityStage.STATUS_APPLICAT;
            case "STATUS_ACCOUNT":
                return OpportunityStage.STATUS_ACCOUNT;
            case "STATUS_COMPLETED":
                return OpportunityStage.STATUS_SUCCESSED;
            case "STATUS_CANCEL":
                return OpportunityStage.STATUS_FAILED;
            default:
                return null;
        }
    }

    /**
     * 把励销订单状态转换成BOSS状态
     *
     * @param lxStatus 励销订单状态
     * @return BOSS状态枚举
     */
    public static OrderStatus convertLxStatus2BossOrderStatus(String lxStatus) {
        switch (lxStatus) {
            case "STATUS_CREATED":
                return OrderStatus.STATUS_CREATED;
            case "STATUS_COLLECT":
                return OrderStatus.STATUS_COLLECT;
            case "STATUS_DECLARE":
                return OrderStatus.STATUS_DECLARE;
            case "STATUS_APPROVAL":
                return OrderStatus.STATUS_APPROVAL;
            case "STATUS_PIDAI":
                return OrderStatus.STATUS_PIDAI;
            case "STATUS_STORAGE":
                return OrderStatus.STATUS_STORAGE;
            case "STATUS_APPLICAT":
                return OrderStatus.STATUS_APPLICAT;
            case "STATUS_ACCOUNT":
                return OrderStatus.STATUS_ACCOUNT;
            case "STATUS_SUCCESSED":
            case "STATUS_COMPLETED":
                return OrderStatus.STATUS_COMPLETED;
            case "STATUS_FAILED":
            case "STATUS_CANCELED":
                return OrderStatus.STATUS_CANCEL;
            default:
                return null;
        }
    }
}
